<template>
  <!-- 只要评论就不需要给edit传入数据 -->
  <div class="editorBox">
    <div v-if="edit">
      <div class="content" v-if="edit.json_content">
        <div class="contenteditor">
          {{ edit.json_content.editor }}
        </div>
        <div class="contentcopyright">
          {{ edit.json_content.copyright }}
        </div>
      </div>
      <!--作者 -->

      <div class="authorBox" v-if="edit.json_content">
        <div class="titles">作者</div>
        <div
          class="authors"
          v-if="edit.json_content.author.authors.length !== 0"
        >
          <div
            class="authorOne"
            v-for="(item, index) in edit.json_content.author.authors"
            :key="index"
          >
            <img
              :src="item.avatar"
              style="width: 40px; height: 40px; border-radius: 50%"
              alt=""
            />
            <div class="two">
              <div class="auTitle">
                <div class="auts">
                  <div class="names">{{ item.name }}</div>
                  <div class="brief">{{ item.brief }}</div>
                </div>
                <div class="auG">关注</div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>

    <!-- 相关推荐  接口数据没有 先注释掉-->
    <!-- <div class="related">
      <div class="relates">相关推荐</div>
    </div> -->

    <!-- 评论列表 -->
    <div class="comment" v-if="comments">
      <div class="comments">评论列表</div>
      <div class="commentList" v-if="comments.data">
        <div class="lists" v-for="(item, index) in comments.data" :key="index">
          <!-- 用户名及发布评论时间 -->
          <div class="userBox">
            <div class="left">
              <div class="userWeb">
                <img :src="item.user.web_url" alt="" />
                <span>{{ item.user.user_name }}</span>
              </div>
            </div>
            <div class="inpDate">{{ item.input_date }}</div>
          </div>
          <!-- 其他用户回复 -->
          <div class="tos" v-if="item.touser">
            <div class="touser">
              {{ item.touser.user_name }} ：{{ item.quote }}
            </div>
          </div>
          <!-- 评论内容 -->
          <div class="commentsConent">
            {{ item.content }}
          </div>

          <!--图标及点赞  -->
          <div class="iconZan">
            <van-icon name="chat-o" /><span class="like"
              ><van-icon name="good-job-o" /></span
            ><span>{{ item.praisenum }}</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: ["edit", "comments"],
  data() {
    return {};
  },
  methods: {},
};
</script>

<style lang="less" scoped>
.editorBox {
  width: 345px;
  margin-bottom: 50px;
  .titles {
    width: 50px;
    height: 30px;
    font-size: 12px;
    border-bottom: 5px solid #000;
  }
  .content {
    padding: 20px 0px;
    .contenteditor {
      margin-bottom: 10px;
    }
    .contentcopyright {
    }
  }

  .authorBox {
    width: 345px;
    .titles {
      margin-bottom: 10px;
    }
    .authors {
      .authorOne {
        display: flex;
        align-items: center;
        margin: 10px 0;
        .two {
          width: 100%;
          .auTitle {
            display: flex;
            justify-content: space-between;
            align-items: center;
            .auts {
              .names {
                font-size: 15px;
                color: #3b3b3b;
              }
              .brief {
                font-size: 12px;
                color: #969696;
              }
            }
            .auG {
              width: 50px;
              height: 30px;
              text-align: center;
              line-height: 30px;
              border: 1px solid #929292;
              color: #929292;
            }
          }
        }
      }
    }
  }
  .related {
    margin-top: 40px;
    .relates {
      width: 50px;
      height: 30px;
      font-size: 12px;
      border-bottom: 5px solid #000;
    }
  }

  .comment {
    margin-top: 40px;
    .comments {
      width: 50px;
      height: 30px;
      font-size: 12px;
      border-bottom: 5px solid #000;
    }
    .commentList {
      .lists {
        padding: 20px 0;
        border-bottom: 1px solid #ebebeb;
        box-sizing: border-box;

        color: #000;
        .userBox {
          display: flex;
          justify-content: space-between;
          align-items: center;
          color: #949494;
          .left {
            .userWeb {
              display: flex;
              align-items: center;
              font-size: 12px;
              img {
                width: 20px;
                height: 20px;
                border-radius: 50%;
              }
            }
          }

          .inpDate {
            font-size: 12px;
          }
        }
        .tos {
          margin: 10px 0;
          .touser {
            padding: 10px;
            border: 1px solid #ebebeb;
            font-size: 14px;
          }
        }
        .commentsConent {
          margin: 10px 0;
        }

        .iconZan {
          text-align: right;
          .like {
            padding: 0 10px 0 15px;
          }
        }
      }
    }
  }
}
</style>